nn.panel = {
	formData:null,	
	getData:function(){
		if(nn.panel.formData ==null){
			dojo.xhrPost({
	            url: "app/edit/editpanel",
	            handleAs: "json",
	            sync:true,
	            load: function(data) {
	            	console.log(' -- on Load Data',data);
	            	nn.panel.formData=data;
	            },error : function(req){
	            	console.log(req);
	            }
	       });
		}
	},	
	show:function(){
		nn.panel.getData();
		dojo.style('pm','display','block');
		dojo.connect(dojo.byId('pmhide'),'onclick',function(){
			nn.panel.hide();
		});	
	},
	hide:function(){
		dojo.style('pm','display','none');
	},
		
	renderBanerForm:function(){
		console.log('nn.panel.formData',nn.panel.formData);
		dojo.byId('pmcnt').innerHTML = nn.panel.formData.forms.baner;
		
		var hand = dojo.connect(dojo.byId('zatwierdz_baner'),'onclick',function(){
			dojo.io.iframe.send({
				url: "app/edit/insertwidget",
				method: "POST",
				form: "formBanerForm",
				handleAs: "json",
				load: function(r) {
					
					if(r.ready==1){
						dojo.disconnect(hand);
						dojo.byId('formContent').innerHTML = r.msg;						
					}
					if(r.error < 0){
						dojo.byId('infoFormBox').innerHTML =  r.msg;					
					}
					console.log(' -- Zatwierdz baner form',r);
			    },
			    error: function(r){
			          console.log(response);

			    }
			});
			

			
		});
	}	
		
		
}
